3.8.80 \(\int (a+a \cos (c+d x)) (-\frac {B}{2}+B \cos (c+d x)) \, dx\) [780]

Optimal. Leaf size=37 \[ \frac {a B \sin (c+d x)}{2 d}+\frac {a B \cos (c+d x) \sin (c+d x)}{2 d} \]

[Out]

1/2*a*B*sin(d*x+c)/d+1/2*a*B*cos(d*x+c)*sin(d*x+c)/d

________________________________________________________________________________________

Rubi [A]
time = 0.01, antiderivative size = 37, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.040, Rules used = {2813} \begin {gather*} \frac {a B \sin (c+d x)}{2 d}+\frac {a B \sin (c+d x) \cos (c+d x)}{2 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + a*Cos[c + d*x])*(-1/2*B + B*Cos[c + d*x]),x]

[Out]

(a*B*Sin[c + d*x])/(2*d) + (a*B*Cos[c + d*x]*Sin[c + d*x])/(2*d)

Rule 2813

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(2*a*c +
 b*d)*(x/2), x] + (-Simp[(b*c + a*d)*(Cos[e + f*x]/f), x] - Simp[b*d*Cos[e + f*x]*(Sin[e + f*x]/(2*f)), x]) /;
 FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]

Rubi steps

\begin {align*} \int (a+a \cos (c+d x)) \left (-\frac {B}{2}+B \cos (c+d x)\right ) \, dx &=\frac {a B \sin (c+d x)}{2 d}+\frac {a B \cos (c+d x) \sin (c+d x)}{2 d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.06, size = 29, normalized size = 0.78 \begin {gather*} \frac {a B (2 c+2 \sin (c+d x)+\sin (2 (c+d x)))}{4 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + a*Cos[c + d*x])*(-1/2*B + B*Cos[c + d*x]),x]

[Out]

(a*B*(2*c + 2*Sin[c + d*x] + Sin[2*(c + d*x)]))/(4*d)

________________________________________________________________________________________

Maple [A]
time = 0.08, size = 51, normalized size = 1.38

method result size
risch \(\frac {a B \sin \left (d x +c \right )}{2 d}+\frac {a B \sin \left (2 d x +2 c \right )}{4 d}\) \(31\)
norman \(\frac {2 a B \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}\) \(32\)
derivativedivides \(\frac {2 a B \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+a B \sin \left (d x +c \right )-a B \left (d x +c \right )}{2 d}\) \(51\)
default \(\frac {2 a B \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+a B \sin \left (d x +c \right )-a B \left (d x +c \right )}{2 d}\) \(51\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+a*cos(d*x+c))*(-1/2*B+B*cos(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/2/d*(2*a*B*(1/2*sin(d*x+c)*cos(d*x+c)+1/2*d*x+1/2*c)+a*B*sin(d*x+c)-a*B*(d*x+c))

________________________________________________________________________________________

Maxima [A]
time = 0.28, size = 45, normalized size = 1.22 \begin {gather*} \frac {{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} B a - 2 \, {\left (d x + c\right )} B a + 2 \, B a \sin \left (d x + c\right )}{4 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))*(-1/2*B+B*cos(d*x+c)),x, algorithm="maxima")

[Out]

1/4*((2*d*x + 2*c + sin(2*d*x + 2*c))*B*a - 2*(d*x + c)*B*a + 2*B*a*sin(d*x + c))/d

________________________________________________________________________________________

Fricas [A]
time = 0.35, size = 24, normalized size = 0.65 \begin {gather*} \frac {{\left (B a \cos \left (d x + c\right ) + B a\right )} \sin \left (d x + c\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))*(-1/2*B+B*cos(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(B*a*cos(d*x + c) + B*a)*sin(d*x + c)/d

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 87 vs. \(2 (32) = 64\).
time = 0.11, size = 87, normalized size = 2.35 \begin {gather*} \begin {cases} \frac {B a x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {B a x \cos ^{2}{\left (c + d x \right )}}{2} - \frac {B a x}{2} + \frac {B a \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {B a \sin {\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (B \cos {\left (c \right )} - \frac {B}{2}\right ) \left (a \cos {\left (c \right )} + a\right ) & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))*(-1/2*B+B*cos(d*x+c)),x)

[Out]

Piecewise((B*a*x*sin(c + d*x)**2/2 + B*a*x*cos(c + d*x)**2/2 - B*a*x/2 + B*a*sin(c + d*x)*cos(c + d*x)/(2*d) +
 B*a*sin(c + d*x)/(2*d), Ne(d, 0)), (x*(B*cos(c) - B/2)*(a*cos(c) + a), True))

________________________________________________________________________________________

Giac [A]
time = 0.45, size = 30, normalized size = 0.81 \begin {gather*} \frac {B a \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} + \frac {B a \sin \left (d x + c\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*cos(d*x+c))*(-1/2*B+B*cos(d*x+c)),x, algorithm="giac")

[Out]

1/4*B*a*sin(2*d*x + 2*c)/d + 1/2*B*a*sin(d*x + c)/d

________________________________________________________________________________________

Mupad [B]
time = 0.63, size = 25, normalized size = 0.68 \begin {gather*} \frac {B\,a\,\left (2\,\sin \left (c+d\,x\right )+\sin \left (2\,c+2\,d\,x\right )\right )}{4\,d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(-(B/2 - B*cos(c + d*x))*(a + a*cos(c + d*x)),x)

[Out]

(B*a*(2*sin(c + d*x) + sin(2*c + 2*d*x)))/(4*d)

________________________________________________________________________________________